package com.shop.blockquenue;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * 什么是阻塞队列？
 * 当队列为空时，队列获从取元素的操作会被阻塞
 * 当队列是满时，往队列中添加元素的操作会被阻塞
 *
 */
public class BlockQuenue {

    public static void main(String[] args) {
        BlockingQueue queue = new LinkedBlockingQueue(10);

        //Executors.newFixedThreadPool()

        System.out.println(queue.offer("Dada"));
        System.out.println(queue.poll());
    }
}
